---
--类名: BattleInfoArena.lua
--创建日期: 2018-6-25
--创建人: galileoliu
--功能描述: 
--修改内容:
--修改日期:   
--修改人:      
--修改备注: 
--

local BattleInfoArena = class("BattleInfoArena")

function BattleInfoArena:ctor(msg)
	self.isSelfTeamA = true

	self.id = rawget(msg, "id")
	self.url = rawget(msg, "url")
	self.authCode = rawget(msg, "authCode")
	self.formationId = rawget(msg, "formationID")
	self.passive = rawget(msg, "passive")
	self.btType = rawget(msg, "battleType")
	self.mapId = rawget(msg, "mapId")
	self.x = rawget(msg, "posX")
	self.usingSelfData = rawget(msg, "isUseSelfData") -- 是否用自身数据（目前只有跨服精英赛为true）
	self.usingArenaAvatar = rawget(msg, "isUsingArenaAvatar") -- 是否使用竞技场时装

	self:readInfo(msg)
end

function BattleInfoArena:readInfo(msg)
	if rawget(msg, "userinfosA") then
		self.userinfosA = {}
		for i,v in ipairs(msg.userinfosA) do
			local info = UserBaseInfo.new(v)
			table.insert(self.userinfosA,info)
		end
	end

	if rawget(msg, "userinfosB") then
		self.userinfosB = {}
		for i,v in ipairs(msg.userinfosB) do
			local info = UserBaseInfo.new(v)

			if UD:isMe(info.uid) then
				self.isSelfTeamA = false
			end

			table.insert(self.userinfosB,info)
		end
	end
end

function BattleInfoArena:getUserInfosA()
	return self.userinfosA
end

function BattleInfoArena:selfIsTeamA()
	return self.isSelfTeamA
end

function BattleInfoArena:getUserInfosB()
	return self.userinfosB
end

function BattleInfoArena:getFormationId()
    return self.formationId
end

function BattleInfoArena:getBattleType()
	return self.btType
end

function BattleInfoArena:getMapId()
    return self.mapId
end

function BattleInfoArena:isUsingSelfData()
	return self.usingSelfData
end

function BattleInfoArena:isUsingArenaAvatar()
	return self.usingArenaAvatar
end

return BattleInfoArena